package demo4;

abstract class Animal {
    public String name;
    public int age;

    public Animal(String name, int age) {
        this.name = name;
        this.age = age;
    }
}

interface IFly {
    void fly();
}

interface IRun {
    void run();
}

interface ISwim {
    void swim();
}

// 实现多个接口
class Dog extends Animal implements IRun {
    public Dog(String name, int age) {
        super(name, age);
    }

    @Override
    public void run() {
        System.out.println(this.name + "正在奔跑");
    }
}

class Frog extends Animal implements IRun, ISwim {
    public Frog(String name, int age) {
        super(name, age);
    }

    @Override
    public void run() {
        System.out.println(this.name + "正在用四条腿跑路");
    }

    @Override
    public void swim() {
        System.out.println(this.name + "正在蛙泳");
    }
}

public class Test {


    public static void running(IRun irun) {
        irun.run();
    }

    public static void main(String[] args) {
//        Frog animal = new Frog("小跳蛙", 10);
        running(new Frog("小跳蛙", 10));
    }
}